import axios from '@/axios'

// 图库列表分类
export function getImageClassList (page) {
  return axios.get('/admin/image_class/' + page)
}
// 增加图库分类
export const createImageClass = data => {
  return axios.post('/admin/image_class', data)
}
// 修改图库分类
export const updateImageClass = (id, data) => {
  return axios.post('/admin/image_class/' + id, data)
}
// 删除图库分类
export const deleteImageClass = id => {
  // 正常形式
  return axios.post('/admin/image_class/' + id + '/delete')
  // 反引号形式
  // return axios.post(`/admin/image_class/${id}/delete`)
}
// 图库列表
export const getImageList = (id, page = 1) => {
  return axios.get(`/admin/image_class/${id}/image/${page}`)
}
// 重命名图片
export function updateImage (id, name) {
  return axios.post(`/admin/image/${id}`, { name })
}
// 删除图片
export function deleteImage (ids) {
  return axios.post(`/admin/image/delete_all`, { ids })
}
